package com.lm.dao;

import com.lm.pojo.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserMapper {
    //查询所有用户
    @Select("select * from USER")
    List<User> getUserList();
    //插入
    @Insert("insert into USER (id, username, age ,create_time) values (#{id}, #{username}, #{age}, #{createTime})")
    int insert(User user);

    //根据id查询用户
    @Select("select * from USER where id = #{id}")
    User getUserById(int id);

    //修改用户
    @Update("update USER set age = #{age},username = #{username} where id = #{id}")
    int updateUser(User user);

    //删除用户
    @Delete("delete from USER where id = #{id}")
    int deleteUser(int id);

}
